dirt={}
while 1:
    x=input()
    if not x:
        break
    a,b=x.split()
    dirt[a]=b
c=input()
if c in dirt:
    print(dirt[c])
else:
    print("asd")
